//
//  MessageViewController.m
//  ReviewDemo
//
//  Created by 龙 on 2018/3/22.
//  Copyright © 2018年 long. All rights reserved.
//

#import "MessageViewController.h"
#import <objc/runtime.h>
#import <objc/message.h>

@interface MessageViewController ()

@end

@implementation MessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    unsigned int count = 0;
    Ivar *ivarList = class_copyIvarList(self.view.class, &count);
    
    for (int i = 0; i < count; i ++)
    {
        Ivar iv = ivarList[i];
        NSString *key = [NSString stringWithUTF8String:ivar_getName(iv)];
        NSLog(@"key ========= %@",key);
    }
    
    [self.view setValue:[UIColor redColor] forKey:@"backgroundColor"];
    
    ////强制修改name属性
    Ivar ivar = class_getInstanceVariable(self.view.class, "_backgroundColorSystemColorName");
    object_setIvar(self.view, ivar, UIColor.yellowColor);
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
